<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>使用WXInline播放器</title>
</head>

<body>
    <div style="display: flex; flex-direction: column;">
        <canvas id="canvas" width="375px" height="250px"></canvas>
        <button id="playBtn">播放</button>
    </div>

    <script src="./index.js"></script>
    <script>
        document.getElementById('playBtn').addEventListener('click', () => {
            WXInlinePlayer.init({
                asmUrl: 'prod.all.asm.combine.js',
                wasmUrl: 'prod.all.wasm.combine.js'
            });
            var player = null;
            var $canvas = document.getElementById('canvas');
            WXInlinePlayer.ready().then(() => {
                if (!player) {
                    player = new WXInlinePlayer({
                        url: './1.flv',
                        $container: $canvas,
                        volume: 1.0,
                        muted: false,
                        cacheSegmentCount: 64,
                        customLoader: null
                    });

                    player.on('loadError', e => {
                        console.log('>>>>> load error happend: ', e);
                    });

                    player.on('loadSuccess', () => {
                        console.log('>>>>> load success');
                    });


                    player.play();
                }
            });
        })
    </script>
</body>

</html>